import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'home',
        component: HomeView
    },
    {
        path: '/about',
        name: 'about',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    }, {
        path: '/system',
        name: 'users',
        component: () => import('../views/layout/Index.vue'),
        children:[
            {
                path:'user',
                name:'user',
                component:() => import('../views/system/User.vue'),
            }
        ]
    },{
        path:'/website',
        name:'website',
        component:()=>import('../views/website/Index.vue'),
        children:[{
             path:'index',
             name:'index',
             component:()=>import('../views/website/pages/Index.vue')
        }]
    },{
         path:'/system',
         name:'system',
         component:()=>import('../views/layout/Index.vue'),
         children:[{
              path:'user',
              name:'user',
              component:()=>import('../views/system/User.vue')
         },{
               path:'role',
               name:'role',
               component:()=>import('../views/system/Role.vue')
         }
         ]
    },{
        path:'/goods',
        name:'goods',
        component:()=>import('../views/layout/Index.vue'),
        children:[{
             path:'info',
             name:'info',
             component:()=>import('../views/goods/Info.vue')
        }]
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router